package com.ruix.app.mapper;

import com.ruix.app.model.Comment;

import org.json.JSONObject;

/**
 * Created by hadexs on 2017/4/27.
 */

public class SendCommentMapper implements ApiMapper<Comment>{
    @Override
    public Comment transform(JSONObject response) {
        if (response != null){
          JSONObject data =   response.optJSONObject("data");
            if (data != null){
               int  success =    data.optInt("success",0);
                if (success == 1){
                   JSONObject commentObject =   data.optJSONObject("comment");
                    Comment comment = new Comment().parse(commentObject);
                    return comment;
                }
            }
        }
        return null;
    }
}
